new Vue({
    el: '#app',
    data() {
      return {
        loading: false,
        form:{
          service_config:{
            Working_Time:'',
            Off_Duty_Time:'',
            Lunch_Start_Time:'',
            Lunch_End_Time:'',
            Enterprise_Info_SerialNumber:$.cookie('enterprise')
          }
        }
      }
    },
    mounted() {
      getDomValue(this,false);
     console.log(getDomValue(this,true,this.form)); 
    },
    methods: {
      submitForm(formName) {
        let _this = this
        let obj = getDomValue(this,true,this.form);
        // this.$refs[formName].validate((valid) => {
          // if (valid) {
            _this.loading = true
            $.ajax({
              url: DomainName + '/getAddAction?token=' + $.cookie('token'),
              type: 'POST',
              data: {
                Data: JSON.stringify(obj),
                Operation_Name:'添加客服配置'
              },
              success: function (res) {
                if (res.Status=='success') {
                  _this.$message.success("提交成功")
                  window.history.go(-1);
                }else{
                  _this.$message.error("操作失败，请联系开发者");
                }
              },
              error: function () {
                _this.$message.error("操作失败，请稍后再试")
              },
              complete: function (XMLHttpRequest) { 
                _this.loading = false
                if (XMLHttpRequest.getResponseHeader("REDIRECT") == "REDIRECT") {
                  window.parent.document.location.href = absolutepath() + XMLHttpRequest.getResponseHeader("CONTENTPATH");
                }
              }
            })
          // } else {
            // console.log("error submit!!");
            // return false;
          // }
        // });
      },
      resetForm(formName) {
        this.$refs[formName].resetFields();
      },
    }
  })